//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#ifndef __ELASTOS_TIMER_H__
#define __ELASTOS_TIMER_H__

#include <regs.h>

enum {
    PIT_Irq                     = 7,
};

EXTERN_C uint32_t    PIT_ClockRate;          // unit: HZ
EXTERN_C uint32_t    PIT_ClockCycle;         // unit: NS

INLINE uint32_t __cdecl PitRead()
{
    uint32_t    uTicks;

    read_cp0_register($9 /*CP0_COUNT*/, uTicks);

    return uTicks;
}

INLINE void PitWrite(uint32_t uTicks)
{
	write_cp0_register($11 /*CP0_COMPARE*/, uTicks);
}

#endif // __ELASTOS_TIMER_H__
